{include file = $smarty.const.APPLICATION_PATH|cat:"/application/views/header.html"}
{literal}
<script type="text/javascript">
    $(function(){
        $('.assortment').hover(function(){
            $('.assort_list').stop().fadeIn();
        },function(){
            $('.assort_list').stop().fadeOut();
        });
    });
</script>
<script type="text/javascript" src="/js/user.js"></script>

<script type="text/javascript">
    $(function(){
        $('.overlay-close,.popup_btn1').click(function(){
            $('.mui-dialog-mask').hide();
            $('.mui-dialog').hide();
        });

        $('.pro_li_ft .blue').click(function(){
            var order_id = $(this).attr("order_id");
            var order_sku_id = $(this).attr("order_sku_id");
            $('.mui-dialog-mask').show();
            $('.mui-dialog').show();
            $("#order_id").val(order_id);
            $("#order_sku_id").val(order_sku_id);
        });
    });
    $(document).delegate('.popup_confirm',"click", function(e) {
        var order_id = $("#order_id").val();
        var order_sku_id = $("#order_sku_id").val();
        var price = $("#price").val();
        var num = $("#num").val();
        var delivery_method = $("#delivery_method").val();
        var delivery_addr = $("#delivery_addr").val();

        if(!price || price==''){
            $("#tip").html("请填写价格！");
        }
        if(!num || num==''){
            $("#tip").html("请填写数量！");
        }
        if(delivery_method==2){
            if(!delivery_addr || delivery_addr==''){
                $("#tip").html("请填写配送地址！");
            }
        }

        $.ajax({
            url:"/user/editsaleorder",
            data:{
                order_id:order_id,
                order_sku_id:order_sku_id,
                price:price,
                num:num,
                delivery_method:delivery_method,
                delivery_addr:delivery_addr,
            },
            type:"post",
            daaType:"json",
            success:function(data){
                if(data==1){
                    window.location.reload();
                }
                if(data==2){
                    $("#tip").html("修改失败，如无法解决请联系客服管理员处理！");
                }
            }
        });

    });
</script>
<style>
    .assort_list{display: none;}
</style>
{/literal}

<div class="help_center">

<div class="crumbs_tmg" style="padding-top:0;">当前位置：<a href="#">首页</a><i class="ffs">></i><a href="#">会员中心</a><i class="ffs">></i><span class="blue">供应订单</span></div>

    {include file = $smarty.const.APPLICATION_PATH|cat:"/application/views/menu_title.html"}
    <div class="user_content">
    	<h3 class="user_title j_ut">
        	<ul>
            	<li class="curr">供应订单</li>
            </ul>
        </h3>
        
        
        <div class="receiving_address">
            
            
            <div class="resource_search">
                <form name="" action="" method="get">品种：<input type="text" name="cate_name" class="rs_ph" value="{$cate_name}"/>牌号：<input type="text" name="product_name" class="rs_ph" value="{$product_name}"/> 厂商：<input type="text" name="brand_name" class="rs_ph" value="{$brand_name}"/>交货地：<input type="text" name="delivery_area" class="rs_ph" value="{$delivery_area}"/> <input class="rs_ph_btn" type="submit" value="搜  索"/></form>
            </div>
            
            <ul class="rs_bar">
            	<li {if $status eq ''} class="curr" {/if}><a href="/user/saleorder">全部状态</a> <i>({$totalItemsall})</i></li>
                <li {if $status eq '1'} class="curr" {/if}><a href="/user/saleorder?status=1">待确认</a><i>({$totalItemsaudit})</i></li>
                <li {if $status eq '2'} class="curr" {/if}><a href="/user/saleorder?status=2">交易中</a><i>({$totalItemsdeal})</i></li>
                <li {if $status eq '3'} class="curr" {/if}><a href="/user/saleorder?status=3">交易完成</a><i>({$totalItemsdone})</i></li>
                <li {if $status eq '4'} class="curr" {/if}><a href="/user/saleorder?status=4">订单取消</a><i>({$totalItemscancel})</i></li>
            </ul>
            
            <ul class="rs_tmn">
            	<li>订单信息</li>
                <li>单价（元/吨）</li>
                <li>数量（吨）</li>
                <li>配送方式</li>
                <li>状态</li>
                <li>操作</li>
            </ul>
            
            <div class="pro_list_items">
            	<ul>
                    {if !$data}
                    <li class="tac" style="padding-top: 10px;">亲，您还没有供应订单哦，赶紧去报价哦!</li>
                    {else}
                    {foreach from=$data key=key item=item}
                	<li>
                    	<div class="pro_li_title">
                        	<span class="pr20">订单号 : {$item.order_key}</span>
                        	<span class="pr20">求购商：{$item.business_name}<img src="/images/login_qq.png" width="16" height="16" onclick="javascript:window.open('http://wpa.qq.com/msgrd?v=3&uin={$item.qq}&site=qq&menu=yes');" class="vam ml5 cp" /></span>
                        	<span class="fr pr20">{$item.order_date}</span>
                        </div>
                        <div class="pro_li_list">
                        	<p>{{$item.cate_name}}-{$item.product_name}/{$item.brand_name}</p>
                            <p class="orange">{$item.currency_mark}{$item.price}</p>
                            <p>{$item.num}</p>
                            <p class="orange">{if $item.delivery_method eq '2'}配送{else}自提{/if}</p>
                            <p>{$_SupplyOrderMean[$item.status]}</p>
                            <p>
                                {if $item.status eq '1'}
                                <a href="/user/setOrderStatus?order_id={$item.order_id}&status=2" class="blue">确认订单</a>
                                <a href="/user/setOrderStatus?order_id={$item.order_id}&status=4" class="blue">取消订单</a>
                                {else if $item.status eq '2'}
                                <a href="/user/setOrderStatus?order_id={$item.order_id}&status=3" class="blue">订单完成</a>
                                {else}
                                <a href="/user/orderdetail?order_id={$item.order_id}" class="blue">查看详情</a>
                                {/if}
                            </p>
                        </div>
                        <div class="pro_li_ft">
                        	<span class="fwb">合计：<i class="orange mr10">{$item.amount}</i></span>
                            {if $item.status eq '1'}
                            <a href="javascript:void (0)" class="blue" order_id="{$item.order_id}" order_sku_id="{$item.order_sku_id}" >修改订单</a>
                            {/if}
                        </div>
                        
                    </li>
                    {/foreach}
                    {/if}

                </ul>
            </div>
            <div class="page tar ptb10p" id="page">{$links}</div>
        </div>
        
    </div>
</div>

<div class="mui-dialog-mask" style="display:none;"></div>
<div class="mui-dialog" style="width:520px;height:400px;display:none;">
    <a href="#" class="overlay-close"></a>
    <div class="mui-diglog-wrap">
        <div class="mui-dialog-header">修改订单</div>
      <div class="mui-dialog-body">
        <ul class="mui_dl_list">
            <input name="order_id" type="hidden" id="order_id" value="">
            <input name="order_sku_id" type="hidden" id="order_sku_id" value="">
            <li>　　单价：<input class="popup_text w280" type="text" name="price" id="price" placeholder="请输入单价"/></li>
            <li>　　数量：<input class="popup_text w280" type="text" name="num" id="num" placeholder="请输入数量"/></li>
            <li><span class="fl mt5">配送方式：</span>
            <div class="popup_se w297">
                <label></label>
                <select name="delivery_method" id="delivery_method">
                    <option value="1">自提</option>
                    <option value="2">配送</option>
                </select>
            </div>
            </li>
            <li class="pl30p"><input class="popup_text w280 mt15" type="text" name="delivery_addr" id="delivery_addr" placeholder="配送地址"/></li>
            <li class="pl30p"><input class="popup_btn popup_230 popup_confirm" type="button" value="确 认"/><input class="popup_btn1 popup_230" type="button" value="取 消"/></li>
        </ul>
          <div id="tip" class="red"></div>
        </div>
    </div>
    
    <div class="mui-dialog-skin"></div>
    
</div>

{include file = $smarty.const.APPLICATION_PATH|cat:"/application/views/footer.html"}